package com.fuyao.cloud.admin.flow.controller;

import com.fuyao.cloud.admin.flow.model.CommentInfo;
import com.fuyao.cloud.admin.flow.service.org.ICommentInfoService;
import com.fuyao.cloud.common.core.util.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
@Api(value = "flowable", tags = "流程流转意见")
@RequestMapping("/flowable/comment")
public class FlowableCommentController {

    private final ICommentInfoService commentInfoService;

    @ApiOperation(value = "根据 businessKey 流程的审批记录")
    @ApiImplicitParam(name = "businessKey", value = "businessKey", required = true, dataTypeClass = String.class, paramType = "path")
    @GetMapping(value = "/getCommentsByBusinessKey/{businessKey}")
    public R<List<CommentInfo>> getCommentsByBusinessKey(@PathVariable("businessKey") String businessKey) {
        return R.ok(commentInfoService.getCommentsByBusinessKey(businessKey));
    }
}
